package com.sunsheng.modules.redis.controller;


import com.sunsheng.modules.redis.service.MQService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/api")
public class MQController {
    private static final String topic = "topic_test";

    @Resource
    private MQService mQService;

    @RequestMapping(value = "/produce", method = RequestMethod.GET)
    public void produce(@RequestParam(name = "key") String key) {
        mQService.produce(topic,key);
    }

    @RequestMapping(value = "/consume", method = RequestMethod.GET)
    public void consume() {
        mQService.consume(topic);
    }

}